<?php

use App\Http\Controllers\CommentController;
use App\Http\Controllers\GoodsController;
use App\Http\Controllers\InvokeController;
use App\Http\Controllers\orderController;
use App\Http\Controllers\PhotoCommentController;
use App\Http\Controllers\SingletonController;
use App\Http\Controllers\UserController;
use Illuminate\Support\Facades\Route;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;


Route::middleware('cache.headers:public;max_age=2628000;etag')->group(function () {
    Route::get('/privacy', function () {
        // ...
    });

    Route::get('/terms', function () {
        // ...
    });
});

Route::get('psr', function (ServerRequestInterface $request, ResponseInterface $response) {
    dump($request, $response);
});
Route::controller(orderController::class)
     ->prefix('order')
     ->name('order.')
     ->group(function () {
         Route::get('{id?}', 'index')->name('index');
         Route::get('input', 'input')->name('input');
         Route::get('data', 'data')->name('data');
         Route::get('file', 'file')->name('file');
         Route::get('response', 'response')->name('response');
         Route::get('response-arr', 'responseArray')->name('response-arr');
         Route::get('model', 'model')->name('model');
         Route::get('redirect', 'redirect')->name('redirect');
         Route::get('download', 'download')->name('download');
         Route::get('order', 'order')->name('order');
         Route::get('view', 'view')->name('view');
         Route::get('urls', 'urls')->name('urls');
         Route::get('session', 'session')->name('session');
     })
;
Route::controller(UserController::class)
     ->prefix('user')
     ->group(function () {
         Route::get('{id}', 'show')
              ->whereNumber('id')
         ;
     })
;
Route::get('invoke', InvokeController::class)
     ->name('invoke')
;
Route::resource('goods', GoodsController::class)
     ->missing(function () {
         return Redirect::route('goods.index');
     })
     ->withTrashed()
     ->only(['restore', 'create'])
     ->except(['index', 'show'])
;
Route::resources([
    'goods-one' => GoodsController::class,
    'goods-two' => GoodsController::class,
    'goods-three' => GoodsController::class,
    'goods-four' => GoodsController::class,
]);
Route::apiResource('api-goods', GoodsController::class)
     ->only(['index', 'show'])
;
Route::apiResources([
    'api-goods-one' => GoodsController::class,
    'api-goods-two' => GoodsController::class,
    'api-goods-three' => GoodsController::class,
]);
Route::resource('photo.comment', PhotoCommentController::class);
Route::resource('photos.comments', CommentController::class)
     ->shallow()
;
Route::singleton('singleton', SingletonController::class)
     ->creatable()
     ->destroyable()
;
Route::apiSingleton('singleton-api', SingletonController::class)
     ->creatable()
     ->destroyable()
;
